<?php
    $this->load->view('wx/public/header.html', [
        'time' => time(),
        'index' => 2,
        'css' => [
            'assets/wx/css/order.css?',
        ]
    ]);
?>

<body class="order" ng-controller="wx-order-index-controller">

<!--tab-->
<div class="aui-tab aui-margin-b-5" id="tab">
    <div class="aui-tab-item" ng-class="{'aui-active': !selectType}" ng-click="select('')">全部</div>
    <div class="aui-tab-item" ng-class="{'aui-active': selectType == 'Unpaid'}" ng-click="select('Unpaid')">待支付</div>
    <div class="aui-tab-item" ng-class="{'aui-active': selectType == 'Pending'}" ng-click="select('Pending')">待发货</div>
    <div class="aui-tab-item" ng-class="{'aui-active': selectType == 'Dispatch'}" ng-click="select('Dispatch')">配送中</div>
    <div class="aui-tab-item" ng-class="{'aui-active': selectType == 'Refund'}" ng-click="select('Refund')">售后/退款</div>
</div>

<section ng-show="lists.length == 0 && loading" style="margin-top: 50px;" class="aui-content gu-order-empty">
    <img src="/assets/wx/img/reading.gif" alt="">
</section>

<section ng-show="lists.length == 0 && !loading" class="aui-content aui-text-center gu-order-empty">
    <i class="aui-iconfont aui-icon-info"></i>
    <p>还没有相应订单</p>
</section>

<section class="aui-content" ng-show="lists.length > 0 && !loading">
    <div class="aui-card-list gu-order-card-list-item" ng-repeat="(index, l) in lists">
        <div class="aui-card-list-header gu-order-sn aui-padded-l-10 aui-padded-r-10 list-box">
            <a ng-if="l.baseName != ''" href="/base?baseId={{g.baseId}}" class="aui-pull-left aui-font-size-14 list-title" ng-bind="l.baseName"></a>
            <span ng-if="l.baseName == ''" href="/base?baseId={{g.baseId}}" class="aui-pull-left aui-font-size-14 list-title2">丘丘谷</span>
            <span class="aui-pull-right aui-font-size-14 gu-desc-color" ng-bind="l.formatStatus"></span>
        </div>
        <div class="aui-card-list-content">
            <ul class="aui-list aui-media-list" ng-click="detail(l)">
                <li class="aui-list-item gu-list-item" ng-repeat="g in l.goods">
                    <div class="aui-media-list-item-inner">
                        <div class="aui-list-item-media gu-list-item-thumb">
                            <img ng-src="{{ g.thumb }}">
                        </div>

                        <div class="aui-list-item-inner">
                            <div class="aui-list-item-text aui-margin-b-15">
                                <div class="aui-list-item-title aui-ellipsis-2 gu-order-goods-name" ng-bind="g.goodsName"></div>
                                <div class="aui-list-item-right gu-order-price" ng-bind="'￥ ' + g.price_format"></div>
                            </div>
                            <div class="aui-info aui-margin-t-10 aui-margin-l-0 aui-margin-r-0 gu-info-item" style="padding:0">
                                <div class="aui-info-item" ng-bind="'规格: ' + g.ruleName"></div>
                                <div class="aui-info-item" ng-bind="'× ' + g.num"></div>
                            </div>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
        <div class="aui-card-list-footer gu-footer-1">
            <p class="aui-pull-right aui-font-size-12">
                共 <span ng-bind="l.goods.length"></span> 类商品&nbsp;&nbsp;&nbsp;商品总价<strong class="aui-font-size-16" ng-bind="' ￥'+l.totalPrice / 100"></strong>
            </p>
        </div>
        <div class="aui-card-list-footer gu-list-footer">
            <div class="buttons" style="width: 100%;">
                <div class="aui-btn aui-btn-outlined aui-btn-sm aui-pull-right aui-margin-l-10 gu-btn gu-list-options"
                     ng-if="l.status == 'Unpaid'" ng-click="chgStatus(index, 'Cancel')">取消订单</div>
                <div class="aui-btn aui-btn-info aui-btn-outlined aui-btn-sm aui-pull-right aui-margin-l-10 gu-btn gu-list-options"
                     ng-if="l.status == 'Dispatch'" ng-click="confirm(index)">确认收货</div>
                <div class="aui-btn aui-btn-outlined aui-btn-sm aui-pull-right aui-margin-l-10 gu-btn gu-list-options"
                     ng-if="l.status == 'Dispatch' || l.status == 'Complete' || l.status == 'Pending'" ng-click="buy(index)">再来一单</div>
                <div class="aui-btn aui-btn-outlined aui-btn-sm aui-pull-right aui-margin-l-10 gu-btn gu-list-options"
                     ng-if="l.status == 'Cancel'" ng-click="chgStatus(index, 'Delete')">删除</div>
                <div class="aui-btn aui-btn-info aui-btn-outlined aui-btn-sm aui-pull-right aui-margin-l-10 gu-btn gu-list-options"
                     ng-if="l.status == 'Unpaid'" ng-click="pay(index)">立即支付</div>
                <div class="aui-btn aui-btn-outlined aui-btn-sm aui-pull-right aui-margin-l-10 gu-btn gu-list-options"
                     ng-if="l.status == 'Complete' && l.commented !=1" ng-click="comment(index)">立即评论</div>
                <div class="aui-btn aui-btn-outlined aui-btn-sm aui-pull-right aui-margin-l-10 gu-btn gu-list-options"
                     ng-if="l.status == 'Complete' || l.status == 'Pending' || l.status == 'Dispatch'" ng-click="refund(index)">申请退款</div>
                <div class="aui-btn aui-btn-outlined aui-btn-sm aui-pull-right aui-margin-l-10 gu-btn gu-list-options"
                     ng-if="l.status == 'Refund' || l.status == 'Refunded'" ng-click="checkRefund(index)">查看退款</div>
            </div>
        </div>
    </div>

</section>

<?php
    $this->load->view('wx/public/footer.html', [
        'time' => time(),
        'js' => [
            'assets/wx/js/order/index.js'
        ]
    ]);
?>
